var http  = require('http');
var fs = require('fs');
var server = http.createServer();

server.on('request',function(request,response){
    //解决跨域问题
    //*表示所有地址都可以访问
    response.setHeader('Access-Control-Allow-Origin','*');

    response.writeHead(200,{
        'Content-Type':'text/plain;charset=utf-8'
    })
    fs.readFile('product.json','utf-8',function(err,data){
        response.end(data);
    })
})
server.listen(3000,function(err){
    console.log('listening port 3000...');
})